﻿// -----------------------------------------------------------------------
// Copyright (c) David Kean. All rights reserved.
// -----------------------------------------------------------------------
extern alias pcl;
using System.Security.Cryptography;
using System.Security.Cryptography.Adaptation;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Windows.Security.Cryptography.Core;
using System.IO;

namespace Portable.Security.Cryptography.Adaptation
{
    [TestClass]
    public class HashAlgorithmAdapterTests
    {
        [TestMethod]
        public void ComputeHash1_EmptyAsData_CanGenerateHash()
        {
            var adapter = new HashAlgorithmAdapter(HashAlgorithmNames.Sha256);

            var result = adapter.ComputeHash(new byte[0]);

            Assert.IsNotNull(result);
        }

        [TestMethod]
        public void ComputeHash2_EmptyAsData_CanGenerateHash()
        {
            var adapter = new HashAlgorithmAdapter(HashAlgorithmNames.Sha256);

            var result = adapter.ComputeHash(new byte[0], 0, 0);

            Assert.IsNotNull(result);
        }

        [TestMethod]
        public void ComputeHash3_EmptyAsInputStream_CanGenerateHash()
        {
            var adapter = new HashAlgorithmAdapter(HashAlgorithmNames.Sha256);

            var result = adapter.ComputeHash(new MemoryStream(new byte[0]));

            Assert.IsNotNull(result);
        }
    }
}
